package com.softstao.guoyu.ui.activity.me;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;

import com.gigamole.library.navigationtabstrip.NavigationTabStrip;
import com.softstao.guoyu.R;
import com.softstao.guoyu.base.BaseActivity;
import com.softstao.guoyu.base.BaseFragment;
import com.softstao.guoyu.ui.fragment.ApplyListFragment;
import com.softstao.guoyu.ui.fragment.RechargeListFragment;
import com.softstao.softstaolibrary.library.widget.CustomTabStrip;
import com.softstao.softstaolibrary.library.widget.NonSwipeableViewPager;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * Created by vaikus on 2017/6/8.
 */

public class BalanceActivity extends BaseActivity {

    @BindView(R.id.tab_strip)
    CustomTabStrip tabStrip;
    @BindView(R.id.viewPager)
    NonSwipeableViewPager viewPager;
    private RechargeListFragment rechargeListFragment;
    private ApplyListFragment applyListFragment;
    private List<BaseFragment> fragmentList = new ArrayList<>();

    @Override
    public int _ContentView() {
        return R.layout.activity_balance;
    }

    @Override
    public void initView() {
        initTitle("虚拟币");
        rechargeListFragment = new RechargeListFragment();
        applyListFragment = new ApplyListFragment();
        fragmentList.add(rechargeListFragment);
        fragmentList.add(applyListFragment);
        viewPager.setOffscreenPageLimit(2);
        viewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
            @Override
            public Fragment getItem(int position) {
                return fragmentList.get(position);
            }

            @Override
            public int getCount() {
                return fragmentList.size();
            }
        });

        tabStrip.setTitles("我的虚拟币", "帮下级充值");
        tabStrip.setTabIndex(0);
        tabStrip.setOnTabStripSelectedIndexListener(new NavigationTabStrip.OnTabStripSelectedIndexListener() {
            @Override
            public void onStartTabSelected(String title, int index) {
            }

            @Override
            public void onEndTabSelected(String title, int index) {
                switch (title){
                    case "我的虚拟币":
                        break;
                    case "帮下级充值":
                        break;
                }
                viewPager.setCurrentItem(index);
            }
        });
    }
}
